﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PayRoller.Include
{
    public partial class UOrgNameInput : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 是否显示输入文本的提示信息
        /// </summary>
        public bool IsDisplayTipInformation
        {
            set
            {
                this.labTip.Visible = value;
            }
        }

        /// <summary>
        /// 获取用户选择的企业ID
        /// </summary>
        public int OrgIDSelected
        {
            get
            {
                int orgIDSelected=0;
                string orgNameGetted = this.txtOrgName.Text;
                if (string.IsNullOrEmpty(orgNameGetted) == false)
                {
                    if (orgNameGetted.Contains("[") && orgNameGetted.Contains("]"))
                    {
                        int beginPos = orgNameGetted.LastIndexOf("[") + 1;
                        int endPos = orgNameGetted.LastIndexOf("]");
                        string orgID = orgNameGetted.Substring(beginPos, endPos - beginPos);
                        if (orgID != string.Empty)
                        {
                            int.TryParse(orgID,out orgIDSelected);
                        }
                    }
                }

                return orgIDSelected;
            }
        }
    }
}